package com.zbcz.erp.activity

import android.content.Intent
import android.os.Bundle
import android.text.TextUtils
import android.util.Log
import android.view.View
import androidx.activity.viewModels
import androidx.core.text.isDigitsOnly
import androidx.core.widget.addTextChangedListener
import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.zbcz.erp.R
import com.zbcz.erp.activity.BusinessTripRequestActivity.Companion.TAG
import com.zbcz.erp.adapter.CommonToolsListAdapter
import com.zbcz.erp.adapter.CommonToolsListAdapter.Companion.CHOOSE_DATA_TYPE
import com.zbcz.erp.adapter.CommonToolsListAdapter.Companion.CHOOSE_DATE_TYPE
import com.zbcz.erp.adapter.CommonToolsListAdapter.Companion.EDIT_TYPE
import com.zbcz.erp.adapter.CommonToolsListAdapter.Companion.REMARK_TYPE
import com.zbcz.erp.adapter.CommonToolsListAdapter.Companion.UPLOAD_FILE_TYPE
import com.zbcz.erp.adapter.CommonToolsListAdapter.UploadFileType
import com.zbcz.erp.adapter.MyApplyToolsAdapter.Companion.MY_TOOLS_BEAN
import com.zbcz.erp.bean.BusinessAddBean
import com.zbcz.erp.bean.BusinessAddBean.Companion.TRAVEL_REIMBURSEMENT_FIELD
import com.zbcz.erp.bean.CommonListBean
import com.zbcz.erp.bean.DoneJobBean
import com.zbcz.erp.bean.MyToolsBean
import com.zbcz.erp.databinding.ActivityTravelFeeListBinding
import com.zbcz.erp.fragment.CommonListFragment
import com.zbcz.erp.fragment.CommonListFragment.Companion.DONE_JOB_BEAN
import com.zbcz.erp.util.DensityUtils
import com.zbcz.erp.util.TRIP_EXPENSE_REIMBURSEMENT
import com.zbcz.erp.util.ToastUtils
import com.zbcz.erp.util.convertDateFormat
import com.zbcz.erp.util.onSingleClick
import com.zbcz.erp.viewmodel.CommonRequestViewModel
import java.io.File

/**
 * 差旅费报销单
 */
@Route(path = TRIP_EXPENSE_REIMBURSEMENT)
class TravelReimBursementFormActivity : BaseActivity() {

    @Autowired(name = MY_TOOLS_BEAN)
    @JvmField
    var toolsBean: MyToolsBean? = null

    @Autowired(name = DONE_JOB_BEAN)
    @JvmField
    var mJobBean: DoneJobBean? = null

    @JvmField
    @Autowired
    var type: Int = 0

    private val mViewModel: CommonRequestViewModel by viewModels()

    private lateinit var mBinding: ActivityTravelFeeListBinding

    companion object {

        fun isNumber(input: String): Boolean {
            // 匹配整数或小数的正则表达式
            val regex = """^-?\d+(\.\d+)?$""".toRegex()
            return regex.matches(input)
        }


        fun String.formatDecimal(): String {
            return if (isNumber((this))) {
                this
            } else {
                "0"
            }
        }

        val topList = listOf(
            CommonListBean(
                id = R.id.business_table,
                title = "出差申请表",
                type = CHOOSE_DATA_TYPE, //
                isShowBottomMargin = false
            ),
            CommonListBean(
                id = R.id.launch_time,
                title = "出发时间",
                type = CHOOSE_DATE_TYPE,
                isShowBottomMargin = false,
                isNecessary = true
            ),
            CommonListBean(
                id = R.id.back_time,
                title = "返回太原/长治时间",
                type = CHOOSE_DATE_TYPE,
                isShowBottomMargin = false,
                isNecessary = true
            ),
            CommonListBean(
                id = R.id.duration,
                title = "时长（天）",
                type = EDIT_TYPE,
                isShowBottomMargin = false,
                isNecessary = true
            ),
            CommonListBean(
                id = R.id.business_trips,
                title = "出差行程",
                type = REMARK_TYPE,
                isNecessary = true
            ),
            CommonListBean(
                id = R.id.itemized_items,
                title = "列支项目",
                type = EDIT_TYPE,
                isShowBottomMargin = false
            ),
            CommonListBean(
                id = R.id.budget_number,
                title = "预算号",
                type = EDIT_TYPE,
                isNecessary = true,
            )
        )

        val transportationList = listOf(
            CommonListBean(
                id = R.id.plane,
                title = "飞机（元）",
                type = EDIT_TYPE,
                isShowBottomMargin = false
            ),
            CommonListBean(
                id = R.id.plane_financial_audit_amount,
                title = "飞机财务审核金额（元）",
                type = EDIT_TYPE,
                isShowBottomMargin = false
            ),
            CommonListBean(
                id = R.id.train_fee,
                title = "火车（元）",
                type = EDIT_TYPE,
                isShowBottomMargin = false
            ),
            CommonListBean(
                id = R.id.train_financial_audit_amount,
                title = "火车财务审核金额（元）",
                type = EDIT_TYPE,
                isShowBottomMargin = false
            ),
            CommonListBean(
                id = R.id.bus,
                title = "汽车（元）",
                type = EDIT_TYPE,
                isShowBottomMargin = false
            ),
            CommonListBean(
                id = R.id.bus_financial_audit_amount,
                title = "汽车财务审核金额（元）",
                type = EDIT_TYPE,
                isShowBottomMargin = false
            ),
            CommonListBean(
                id = R.id.ship,
                title = "轮船（元）",
                type = EDIT_TYPE,
                isShowBottomMargin = false
            ),
            CommonListBean(
                id = R.id.ship_financial_audit_amount,
                title = "轮船财务审核金额（元）",
                type = EDIT_TYPE,
                isShowBottomMargin = false
            ),
            CommonListBean(
                id = R.id.subtotal_of_transportation,
                title = "交通费小计（元）",
                type = EDIT_TYPE,
                isShowBottomMargin = false
            )
        )
        val costList = listOf(
            CommonListBean(
                id = R.id.accommodation_fee,
                title = "住宿费（元）",
                type = EDIT_TYPE,
                isShowBottomMargin = false
            ),
            CommonListBean(
                id = R.id.accommodation_financial_fee,
                title = "住宿费财务审核金额（元）",
                type = EDIT_TYPE,
                isShowBottomMargin = false
            ),
            CommonListBean(
                id = R.id.business_day_count,
                title = "出差天数（天）",
                type = EDIT_TYPE,
                isShowBottomMargin = false
            ),
            CommonListBean(
                id = R.id.business_financial_audit_day_count,
                title = "财务天数审核数（天）",
                type = EDIT_TYPE,
                isShowBottomMargin = false
            ),
            CommonListBean(
                id = R.id.subtotal_of_food_allowance,
                title = "伙食补助费小计",
                type = EDIT_TYPE,
                isShowBottomMargin = false
            ),
            CommonListBean(
                id = R.id.subtotal_of_public_and_miscellaneous_expenses,
                title = "公杂费小计",
                type = EDIT_TYPE,
                isShowBottomMargin = false
            ),
            CommonListBean(
                id = R.id.booking_fee,
                title = "订票费（元）",
                type = EDIT_TYPE,
                isShowBottomMargin = false
            ),
            CommonListBean(
                id = R.id.booking_financial_audit_fee,
                title = "订票财务审核金额（元）",
                type = EDIT_TYPE,
                isShowBottomMargin = false
            ),
            CommonListBean(
                id = R.id.subtotal_of_cost_assistance,
                title = "费用补助小计",
                type = EDIT_TYPE,
                isShowBottomMargin = false
            )
        )

        val otherList = listOf(
            CommonListBean(
                id = R.id.conference_fee,
                title = "会议费（元）",
                type = EDIT_TYPE,
                isShowBottomMargin = false
            ),
            CommonListBean(
                id = R.id.conference_fee_financial_audit,
                title = "会议财务审核金额（元）",
                type = EDIT_TYPE,
                isShowBottomMargin = false
            ),
            CommonListBean(
                id = R.id.rental_fee,
                title = "出租费（元）",
                type = EDIT_TYPE,
                isShowBottomMargin = false
            ),
            CommonListBean(
                id = R.id.rental_fee_financial_audit_fee,
                title = "出租财务审核金额（元）",
                type = EDIT_TYPE,
                isShowBottomMargin = false
            ),
            CommonListBean(
                id = R.id.refund_fee,
                title = "退票费（元）",
                type = EDIT_TYPE,
                isShowBottomMargin = false
            ),
            CommonListBean(
                id = R.id.refund_fee_financial_audit,
                title = "退票费财务审核金额（元）",
                type = EDIT_TYPE,
                isShowBottomMargin = false
            ),
            CommonListBean(
                id = R.id.other_fee,
                title = "其他费（元）",
                type = EDIT_TYPE,
                isShowBottomMargin = false
            ),
            CommonListBean(
                id = R.id.other_fee_financial_audit,
                title = "其他财务审核金额（元）",
                type = EDIT_TYPE,
                isShowBottomMargin = false
            ),
            CommonListBean(
                id = R.id.other_fee_count,
                title = "其他费小计",
                type = EDIT_TYPE,
                isShowBottomMargin = false
            )
        )

        val bottomList = listOf(
            CommonListBean(
                id = R.id.total_amount,
                title = "合计金额",
                type = EDIT_TYPE,
                isNecessary = true
            ),
            CommonListBean(
                id = R.id.annex,
                title = "附件",
                type = UPLOAD_FILE_TYPE,
                isNecessary = true
            ),
            CommonListBean(
                id = R.id.receiving_unit,
                title = "收款单位名称",
                type = EDIT_TYPE,
                isNecessary = true
            ),
            CommonListBean(
                id = R.id.bank,
                title = "开户行",
                type = EDIT_TYPE,
                isNecessary = true
            ),
            CommonListBean(
                id = R.id.account,
                title = "账号",
                type = EDIT_TYPE,
                isNecessary = true
            ),
            CommonListBean(
                id = R.id.remark_type,
                title = "备注",
                type = EDIT_TYPE,
            )
        )
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        mBinding = ActivityTravelFeeListBinding.inflate(layoutInflater)
        setContentView(mBinding.root)
        ARouter.getInstance().inject(this)
        init()
        initUploadInfos()
        super.onCreate(savedInstanceState)
    }

    private var mTopAdapter: CommonToolsListAdapter? = null
    private var mBottomAdapter: CommonToolsListAdapter? = null
    private var mTravelAdapter: CommonToolsListAdapter? = null
    private var mCostSubsidyAdapter: CommonToolsListAdapter? = null
    private var mOtherFeeAdapter: CommonToolsListAdapter? = null


    private fun init() {
        mBinding.clParent.setPadding(
            0,
            DensityUtils.dp2px(this, 48f),
            0,
            0
        )
        mBinding.clTitle.ivCommonBack.onSingleClick {
            finish()
        }
        mBinding.clTitle.tvTitle.text = "差旅费报销单"
        mTopAdapter = CommonToolsListAdapter(isEditAble = toolsBean != null).apply {
            submitList(topList)
        }
        mBinding.rcTopList.adapter = mTopAdapter

        mBottomAdapter = CommonToolsListAdapter(isEditAble = toolsBean != null).apply {
            submitList(bottomList)
        }
        mBinding.rcBottomList.adapter = mBottomAdapter

        mBinding.tvConfirm.onSingleClick {
            onConfirmClick()
        }
        mBinding.tvCancel.onSingleClick {
            finish()
        }
        mTravelAdapter = CommonToolsListAdapter(isEditAble = toolsBean != null).apply {
            submitList(transportationList)
        }
        mBinding.rcTransportationList.adapter = mTravelAdapter

        mCostSubsidyAdapter = CommonToolsListAdapter(isEditAble = toolsBean != null).apply {
            submitList(costList)
        }
        mBinding.rcCostSubsidyList.adapter = mCostSubsidyAdapter

        mOtherFeeAdapter = CommonToolsListAdapter(isEditAble = toolsBean != null).apply {
            submitList(otherList)
        }
        mBinding.rcOtherFeeList.adapter = mOtherFeeAdapter

        mViewModel.requestResult.observe(this) { pair ->
            if (pair.second == true) {
                ToastUtils.show("提交成功")
                finish()
            } else {
                ToastUtils.show(pair.first)
            }
        }
        //Handler().postDelayed({ initializeViews() }, 2000)
        mBinding.tvCancel.onSingleClick {
            finish()
        }
    }

    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)
        if (requestCode == ErpWorkProcessActivity.REQUEST_CODE_OPEN_DOCUMENT && resultCode == RESULT_OK) {
            data?.data?.let { fileUri ->
                Log.d(TAG, fileUri.toString())
                val viewHolder = mBottomAdapter?.findTargetViewHolder(R.id.annex)
                if (viewHolder is UploadFileType) {
                    viewHolder.mFileAdapter?.addData(fileUri)
                }
            }
        }
    }

    /**
     * 初始化上传信息
     */
    private fun initUploadInfos() {
        if (type == CommonListFragment.MY_TO_DO_LIST || type == CommonListFragment.MY_DONE_LIST || type == CommonListFragment.MY_APPLY || type == CommonListFragment.RE_APPLY) {
            if (type != CommonListFragment.RE_APPLY) {
                //setFieldsEditable(false)
            }
            mViewModel.queryFormInfo(mJobBean?.tableId ?: "", mJobBean?.tableName ?: "")
            mViewModel.mQueryFormInfo.observe(this) { addBean ->
                //populateFormFields(addBean)
                if (addBean != null) {
                    initializeViews(addBean)
                }
                if (type == CommonListFragment.RE_APPLY) {
                    if (addBean != null) {
                        //displayReApplyViews(addBean)
                    }
                }
            }

            when (type) {
                CommonListFragment.MY_TO_DO_LIST -> displayToDoViews()
                CommonListFragment.MY_DONE_LIST, CommonListFragment.MY_APPLY -> displayDoneViews()
                //MY_APPLY -> displayReApplyViews()
            }
        }
    }

    /**
     * 显示待办视图
     */
    private fun displayToDoViews() {
        with(mBinding) {
//            tvContentAdvice.visibility = View.VISIBLE
//            edContentAdvice.visibility = View.VISIBLE
//            tvAdviceCount.visibility = View.VISIBLE
            llAdviceList.visibility = View.VISIBLE
            tvCancel.text = "驳回"
            tvConfirm.text = "同意"
            tvCancel.onSingleClick {
                onApplyConfirmClick(
                    mJobBean?.id ?: "", mJobBean?.procInstId ?: "", false
                )
            }
            tvConfirm.onSingleClick {
                onApplyConfirmClick(
                    mJobBean?.id ?: "", mJobBean?.procInstId ?: "", true
                )
            }

            mViewModel.mActPassLiveData.observe(this@TravelReimBursementFormActivity) { result ->
                handleApprovalResult(result)
            }

            mViewModel.mActBackLiveData.observe(this@TravelReimBursementFormActivity) { result ->
                handleRejectionResult(result)
            }

            edContentAdvice.addTextChangedListener { text ->
                val textSize = text.toString().length
                tvAdviceCount.text = "$textSize/100"
            }
        }
    }

    /**
     * 显示已完成视图
     */
    private fun displayDoneViews() {
        with(mBinding) {
            clBottomParent.visibility = View.GONE
            nsParent.setPadding(0, 0, 0, 0)
        }
    }

    /**
     * 审批或驳回点击事件
     */
    private fun onApplyConfirmClick(id: String, procInstId: String, isPass: Boolean) {
        mViewModel.actPass(isPass, id, procInstId, mBinding.edContentAdvice.text.toString())
    }

    /**
     * 处理审批结果
     */
    private fun handleApprovalResult(result: Pair<Boolean, String?>) {
        if (result.first) {
            ToastUtils.show("审批通过")
            finish()
        } else {
            ToastUtils.show(result.second ?: "")
        }
    }

    /**
     * 处理驳回结果
     */
    private fun handleRejectionResult(result: Pair<Boolean, String?>) {
        if (result.first) {
            ToastUtils.show("驳回成功")
            finish()
        } else {
            ToastUtils.show(result.second ?: "")
        }
    }


    private fun onConfirmClick() {
        val mAddBean = BusinessAddBean().apply {
            id = toolsBean?.id
            name = toolsBean?.name
            procDeTitle = toolsBean?.name
            procDefId = toolsBean?.id
            filedNames = TRAVEL_REIMBURSEMENT_FIELD
            tableName = BusinessAddBean.ZB_TRAVEL_REIMBURSEMENT_TABLE
        }


        // 获取和处理差旅申请表
        val businessTableViewHolder = mTopAdapter?.findTargetViewHolder(R.id.business_table)
        if (businessTableViewHolder is CommonToolsListAdapter.ChooseDataTypeHolder) {
            // 处理差旅申请表的逻辑
            // 例如：设置初始值或默认选择
            //businessTableViewHolder.binding.edE
        }

        // 获取和处理出发时间
        val launchTimeViewHolder = mTopAdapter?.findTargetViewHolder(R.id.launch_time)
        if (launchTimeViewHolder is CommonToolsListAdapter.ChooseDateTypeHolder) {
            launchTimeViewHolder.binding.tvSubTitle.text.toString()?.let {
                if (TextUtils.isEmpty(it) || TextUtils.equals("请选择", it)) {
                    ToastUtils.show("请输入出发时间")
                    return
                } else {
                    mAddBean.travel_business_begin_date =
                        convertDateFormat(launchTimeViewHolder.binding.tvSubTitle.text.toString())
                }
            }
        }

        // 获取和处理返回时间
        val backTimeViewHolder = mTopAdapter?.findTargetViewHolder(R.id.back_time)
        if (backTimeViewHolder is CommonToolsListAdapter.ChooseDateTypeHolder) {
            // 设置返回时间的初始值或逻辑
            backTimeViewHolder.binding.tvSubTitle.text.toString()?.let {
                if (TextUtils.isEmpty(it) || TextUtils.equals("请选择", it)) {
                    ToastUtils.show("请输入返回时间")
                    return
                } else {
                    mAddBean.travel_business_end_date =
                        convertDateFormat(backTimeViewHolder.binding.tvSubTitle.text.toString())
                }
            }
        }

        // 获取和处理出差时长
        val durationViewHolder = mTopAdapter?.findTargetViewHolder(R.id.duration)
        if (durationViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            if (TextUtils.isEmpty(durationViewHolder.binding.edEditFile.text.toString())) {
                ToastUtils.show("请输入出差时长")
                return
            } else {
                mAddBean.travel_business_duration =
                    durationViewHolder.binding.edEditFile.text.toString()
            }
            // 设置出差时长的初始值或逻辑
            //durationViewHolder.binding.edEditFile.setText("3")
        }

        // 获取和处理出差行程
        val businessTripsViewHolder = mTopAdapter?.findTargetViewHolder(R.id.business_trips)
        if (businessTripsViewHolder is CommonToolsListAdapter.RemarkTypeHolder) {
            if (TextUtils.isEmpty(businessTripsViewHolder.binding.edInputRemark.text.toString())) {
                ToastUtils.show("请输入出差行程")
                return
            } else {
                mAddBean.travel_business_trip =
                    businessTripsViewHolder.binding.edInputRemark.text.toString()
            }
            // 设置出差行程的初始值或逻辑
            //businessTripsViewHolder.binding.edInputRemark.setText("默认出差行程")
        }

        // 获取和处理列支项目
        val itemizedItemsViewHolder = mTopAdapter?.findTargetViewHolder(R.id.itemized_items)
        if (itemizedItemsViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 处理列支项目的逻辑
            mAddBean.travel_business_project =
                itemizedItemsViewHolder.binding.edEditFile.text.toString()
            //itemizedItemsViewHolder.binding.edEditFile.setText("列支项目内容")
        }

        // 获取和处理预算号
        val budgetNumberViewHolder = mTopAdapter?.findTargetViewHolder(R.id.budget_number)
        if (budgetNumberViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            if (TextUtils.isEmpty(budgetNumberViewHolder.binding.edEditFile.text.toString())) {
                ToastUtils.show("请输入预算号")
                return
            } else {
                mAddBean.travel_business_budget_number =
                    budgetNumberViewHolder.binding.edEditFile.text.toString()
            }
            // 设置预算号的初始值或逻辑
            //budgetNumberViewHolder.binding.edEditFile.setText("默认预算号")
        }

        // 获取和处理飞机费用
        val planeViewHolder = mTravelAdapter?.findTargetViewHolder(R.id.plane)
        if (planeViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            mAddBean.travel_business_airplane_expenses =
                planeViewHolder.binding.edEditFile.text.toString().formatDecimal()
            // 设置飞机费用的初始值或逻辑
            //planeViewHolder.binding.edEditFile.setText("0")
        }

        // 获取和处理飞机财务审核金额
        val planeFinancialAuditAmountViewHolder =
            mTravelAdapter?.findTargetViewHolder(R.id.plane_financial_audit_amount)
        if (planeFinancialAuditAmountViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            mAddBean.travel_business_airplane_financial_audit_amount =
                planeFinancialAuditAmountViewHolder.binding.edEditFile.text.toString().formatDecimal()
            // 设置飞机财务审核金额的初始值或逻辑
            //planeFinancialAuditAmountViewHolder.binding.edEditFile.setText("0")
        }

        // 获取和处理火车费用
        val trainFeeViewHolder = mTravelAdapter?.findTargetViewHolder(R.id.train_fee)
        if (trainFeeViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            mAddBean.travel_business_train_expenses =
                trainFeeViewHolder.binding.edEditFile.text.toString().formatDecimal()
            // 设置火车费用的初始值或逻辑
            //trainFeeViewHolder.binding.edEditFile.setText("0")
        }

        // 获取和处理火车财务审核金额
        val trainFinancialAuditAmountViewHolder =
            mTravelAdapter?.findTargetViewHolder(R.id.train_financial_audit_amount)
        if (trainFinancialAuditAmountViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            mAddBean.travel_business_train_financial_audit_amount =
                trainFinancialAuditAmountViewHolder.binding.edEditFile.text.toString().formatDecimal()
            // 设置火车财务审核金额的初始值或逻辑
            //trainFinancialAuditAmountViewHolder.binding.edEditFile.setText("0")
        }

        // 获取和处理汽车费用
        val busViewHolder = mTravelAdapter?.findTargetViewHolder(R.id.bus)
        if (busViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置汽车费用的初始值或逻辑
            mAddBean.travel_business_car_expenses =
                busViewHolder.binding.edEditFile.text.toString().formatDecimal()
            //busViewHolder.binding.edEditFile.setText("0")
        }

        // 获取和处理汽车财务审核金额
        val busFinancialAuditAmountViewHolder =
            mTravelAdapter?.findTargetViewHolder(R.id.bus_financial_audit_amount)
        if (busFinancialAuditAmountViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            mAddBean.travel_business_car_financial_audit_amount =
                busFinancialAuditAmountViewHolder.binding.edEditFile.text.toString().formatDecimal()
            // 设置汽车财务审核金额的初始值或逻辑
            //busFinancialAuditAmountViewHolder.binding.edEditFile.setText("0")
        }

        // 获取和处理轮船费用
        val shipViewHolder = mTravelAdapter?.findTargetViewHolder(R.id.ship)
        if (shipViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            mAddBean.travel_business_ship_expenses =
                shipViewHolder.binding.edEditFile.text.toString().formatDecimal()
            // 设置轮船费用的初始值或逻辑
            //shipViewHolder.binding.edEditFile.setText("0")
        }

        // 获取和处理轮船财务审核金额
        val shipFinancialAuditAmountViewHolder =
            mTravelAdapter?.findTargetViewHolder(R.id.ship_financial_audit_amount)
        if (shipFinancialAuditAmountViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            mAddBean.travel_business_ship_financial_audit_amount =
                shipFinancialAuditAmountViewHolder.binding.edEditFile.text.toString().formatDecimal()
            // 设置轮船财务审核金额的初始值或逻辑
            //shipFinancialAuditAmountViewHolder.binding.edEditFile.setText("0")
        }

        // 获取和处理交通费小计
        val subtotalOfTransportationViewHolder =
            mTravelAdapter?.findTargetViewHolder(R.id.subtotal_of_transportation)
        if (subtotalOfTransportationViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            mAddBean.travel_business_traffic_expenses =
                subtotalOfTransportationViewHolder.binding.edEditFile.text.toString().formatDecimal()
            // 设置交通费小计的初始值或逻辑
            //subtotalOfTransportationViewHolder.binding.edEditFile.setText("0")
        }

        // 获取和处理住宿费
        val accommodationFeeViewHolder =
            mCostSubsidyAdapter?.findTargetViewHolder(R.id.accommodation_fee)
        if (accommodationFeeViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            mAddBean.travel_business_accommodation_expenses =
                accommodationFeeViewHolder.binding.edEditFile.text.toString().formatDecimal()
            // 设置住宿费的初始值或逻辑
            //accommodationFeeViewHolder.binding.edEditFile.setText("0")
        }

        // 获取和处理住宿费财务审核金额
        val accommodationFinancialFeeViewHolder =
            mCostSubsidyAdapter?.findTargetViewHolder(R.id.accommodation_financial_fee)
        if (accommodationFinancialFeeViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            mAddBean.travel_business_accommodation_financial_audit_amount =
                accommodationFinancialFeeViewHolder.binding.edEditFile.text.toString().formatDecimal()

            // 设置住宿费财务审核金额的初始值或逻辑
            //accommodationFinancialFeeViewHolder.binding.edEditFile.setText("0")
        }

        // 获取和处理出差天数
        val businessDayCountViewHolder =
            mCostSubsidyAdapter?.findTargetViewHolder(R.id.business_day_count)
        if (businessDayCountViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            if (TextUtils.isEmpty(businessDayCountViewHolder.binding.edEditFile.text.toString())) {
                ToastUtils.show("请输入出差天数")
                return
            }
            mAddBean.travel_business_days =
                businessDayCountViewHolder.binding.edEditFile.text.toString()
            // 设置出差天数的初始值或逻辑
            //businessDayCountViewHolder.binding.edEditFile.setText("0")
        }

        // 获取和处理财务天数审核数
        val financialAuditDayCountViewHolder =
            mCostSubsidyAdapter?.findTargetViewHolder(R.id.business_financial_audit_day_count)
        if (financialAuditDayCountViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            mAddBean.travel_business_financial_audit_days =
                financialAuditDayCountViewHolder.binding.edEditFile.text.toString().formatDecimal()
            // 设置财务天数审核数的初始值或逻辑
            //financialAuditDayCountViewHolder.binding.edEditFile.setText("0")
        }

        // 获取和处理伙食补助费小计
        val subtotalOfFoodAllowanceViewHolder =
            mCostSubsidyAdapter?.findTargetViewHolder(R.id.subtotal_of_food_allowance)
        if (subtotalOfFoodAllowanceViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            mAddBean.travel_business_food_expenses =
                subtotalOfFoodAllowanceViewHolder.binding.edEditFile.text.toString().formatDecimal()
            // 设置伙食补助费小计的初始值或逻辑
            //subtotalOfFoodAllowanceViewHolder.binding.edEditFile.setText("0")
        }

        // 获取和处理公杂费小计
        val subtotalOfPublicAndMiscellaneousExpensesViewHolder =
            mCostSubsidyAdapter?.findTargetViewHolder(R.id.subtotal_of_public_and_miscellaneous_expenses)
        if (subtotalOfPublicAndMiscellaneousExpensesViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            mAddBean.travel_business_miscellaneous_expenses =
                subtotalOfPublicAndMiscellaneousExpensesViewHolder.binding.edEditFile.text.toString().formatDecimal()
            // 设置公杂费小计的初始值或逻辑
            //subtotalOfPublicAndMiscellaneousExpensesViewHolder.binding.edEditFile.setText("0")
        }

        // 获取和处理订票费
        val bookingFeeViewHolder = mCostSubsidyAdapter?.findTargetViewHolder(R.id.booking_fee)
        if (bookingFeeViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            mAddBean.travel_business_ticket_expenses =
                bookingFeeViewHolder.binding.edEditFile.text.toString().formatDecimal()
            // 设置订票费的初始值或逻辑
            //bookingFeeViewHolder.binding.edEditFile.setText("0")
        }

        // 获取和处理订票财务审核金额
        val bookingFinancialAuditFeeViewHolder =
            mCostSubsidyAdapter?.findTargetViewHolder(R.id.booking_financial_audit_fee)
        if (bookingFinancialAuditFeeViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            mAddBean.travel_business_ticket_financial_audit_amount =
                bookingFinancialAuditFeeViewHolder.binding.edEditFile.text.toString().formatDecimal()
            // 设置订票财务审核金额的初始值或逻辑
            //bookingFinancialAuditFeeViewHolder.binding.edEditFile.setText("0")
        }

        // 获取和处理其他费用小计
        val subtotalOfCostAssistanceViewHolder =
            mCostSubsidyAdapter?.findTargetViewHolder(R.id.subtotal_of_cost_assistance)
        if (subtotalOfCostAssistanceViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置其他费用小计的初始值或逻辑
            //subtotalOfCostAssistanceViewHolder.binding.edEditFile.setText("0")
            mAddBean.travel_business_subsidy_expenses =
                subtotalOfCostAssistanceViewHolder.binding.edEditFile.text.toString().formatDecimal()
        }

        // 获取和处理会议费
        val conferenceFeeViewHolder = mOtherFeeAdapter?.findTargetViewHolder(R.id.conference_fee)
        if (conferenceFeeViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置会议费的初始值或逻辑
            //conferenceFeeViewHolder.binding.edEditFile.setText("0")
            mAddBean.travel_business_meeting_expenses =
                conferenceFeeViewHolder.binding.edEditFile.text.toString().formatDecimal()
        }

        // 获取和处理会议财务审核金额
        val conferenceFeeFinancialAuditViewHolder =
            mOtherFeeAdapter?.findTargetViewHolder(R.id.conference_fee_financial_audit)
        if (conferenceFeeFinancialAuditViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置会议财务审核金额的初始值或逻辑
            mAddBean.travel_business_meeting_financial_audit_amount =
                conferenceFeeFinancialAuditViewHolder.binding.edEditFile.text.toString().formatDecimal()
            //conferenceFeeFinancialAuditViewHolder.binding.edEditFile.setText("0")
        }

        // 获取和处理出租费
        val rentalFeeViewHolder = mOtherFeeAdapter?.findTargetViewHolder(R.id.rental_fee)
        if (rentalFeeViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            mAddBean.travel_business_rent_expenses =
                rentalFeeViewHolder.binding.edEditFile.text.toString().formatDecimal()
            // 设置出租费的初始值或逻辑
            //rentalFeeViewHolder.binding.edEditFile.setText("0")
        }

        // 获取和处理出租财务审核金额
        val rentalFeeFinancialAuditFeeViewHolder =
            mOtherFeeAdapter?.findTargetViewHolder(R.id.rental_fee_financial_audit_fee)
        if (rentalFeeFinancialAuditFeeViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置出租财务审核金额的初始值或逻辑
            //rentalFeeFinancialAuditFeeViewHolder.binding.edEditFile.setText("0")
            mAddBean.travel_business_rent_financial_audit_amount =
                rentalFeeFinancialAuditFeeViewHolder.binding.edEditFile.text.toString().formatDecimal()
        }

        // 获取和处理退票费
        val refundFeeViewHolder = mOtherFeeAdapter?.findTargetViewHolder(R.id.refund_fee)
        if (refundFeeViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置退票费的初始值或逻辑
            //refundFeeViewHolder.binding.edEditFile.setText("0")
            mAddBean.travel_business_refund_expenses =
                refundFeeViewHolder.binding.edEditFile.text.toString().formatDecimal()
        }

        // 获取和处理退票费财务审核金额
        val refundFeeFinancialAuditViewHolder =
            mOtherFeeAdapter?.findTargetViewHolder(R.id.refund_fee_financial_audit)
        if (refundFeeFinancialAuditViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            mAddBean.travel_business_refund_financial_audit_amount =
                refundFeeFinancialAuditViewHolder.binding.edEditFile.text.toString().formatDecimal()
            // 设置退票费财务审核金额的初始值或逻辑
            //refundFeeFinancialAuditViewHolder.binding.edEditFile.setText("0")
        }

        // 获取和处理其他费用
        val otherFeeViewHolder = mOtherFeeAdapter?.findTargetViewHolder(R.id.other_fee)
        if (otherFeeViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            mAddBean.travel_business_other_expenses =
                otherFeeViewHolder.binding.edEditFile.text.toString().formatDecimal()
            // 设置其他费用的初始值或逻辑
            //otherFeeViewHolder.binding.edEditFile.setText("0")
        }

        // 获取和处理其他费用财务审核金额
        val otherFeeFinancialAuditViewHolder =
            mOtherFeeAdapter?.findTargetViewHolder(R.id.other_fee_financial_audit)
        if (otherFeeFinancialAuditViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            mAddBean.travel_business_other_financial_audit_amount =
                otherFeeFinancialAuditViewHolder.binding.edEditFile.text.toString().formatDecimal()
            // 设置其他费用财务审核金额的初始值或逻辑
            //otherFeeFinancialAuditViewHolder.binding.edEditFile.setText("0")
        }

        // 获取和处理其他费用小计
        val otherFeeCountViewHolder = mOtherFeeAdapter?.findTargetViewHolder(R.id.other_fee_count)
        if (otherFeeCountViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            mAddBean.travel_business_other_expenses_subtotal =
                otherFeeCountViewHolder.binding.edEditFile.text.toString().formatDecimal()
            // 设置其他费用小计的初始值或逻辑
            //otherFeeCountViewHolder.binding.edEditFile.setText("0")
        }

        // 获取和处理合计金额
        val totalAmountViewHolder = mBottomAdapter?.findTargetViewHolder(R.id.total_amount)
        if (totalAmountViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置合计金额的初始值或逻辑
            //totalAmountViewHolder.binding.edEditFile.setText("0")
            if (TextUtils.isEmpty(totalAmountViewHolder.binding.edEditFile.text.toString())) {
                ToastUtils.show("请输入合计金额")
                return
            } else {
                mAddBean.travel_business_total_amount =
                    totalAmountViewHolder.binding.edEditFile.text.toString().formatDecimal()
            }
        }

        var mTargetFile: File? = null
        // 获取和处理附件
        val annexViewHolder = mBottomAdapter?.findTargetViewHolder(R.id.annex)
        if (annexViewHolder is CommonToolsListAdapter.UploadFileType) {
            // 设置附件的初始值或逻辑
            //annexViewHolder.binding.edEditFile.setText("默认附件")
            mTargetFile = annexViewHolder.mFileAdapter?.getTargetFile(this)
        }

        // 获取和处理收款单位名称
        val receivingUnitViewHolder = mBottomAdapter?.findTargetViewHolder(R.id.receiving_unit)
        if (receivingUnitViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            if (TextUtils.isEmpty(receivingUnitViewHolder.binding.edEditFile.text.toString())) {
                ToastUtils.show("请输入收款单位名称")
                return
            } else {
                mAddBean.travel_business_receiving_unit =
                    receivingUnitViewHolder.binding.edEditFile.text.toString()
            }
            // 设置收款单位名称的初始值或逻辑
            //receivingUnitViewHolder.binding.edEditFile.setText("默认收款单位")
        }

        // 获取和处理开户行
        val bankViewHolder = mBottomAdapter?.findTargetViewHolder(R.id.bank)
        if (bankViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置开户行的初始值或逻辑
            //bankViewHolder.binding.edEditFile.setText("默认开户行")
            if (TextUtils.isEmpty(bankViewHolder.binding.edEditFile.text.toString())) {
                ToastUtils.show("请输入开户行")
                return
            } else {
                mAddBean.travel_business_bank =
                    bankViewHolder.binding.edEditFile.text.toString()
            }

        }

        // 获取和处理账号
        val accountViewHolder = mBottomAdapter?.findTargetViewHolder(R.id.account)
        if (accountViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置账号的初始值或逻辑
            // accountViewHolder.binding.edEditFile.setText("默认账号")
            if (TextUtils.isEmpty(accountViewHolder.binding.edEditFile.text.toString())) {
                ToastUtils.show("请输入账号")
                return
            } else {
                mAddBean.travel_business_account =
                    accountViewHolder.binding.edEditFile.text.toString()
            }
        }

        // 获取和处理备注
        val remarkTypeViewHolder = mBottomAdapter?.findTargetViewHolder(R.id.remark_type)
        if (remarkTypeViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            mAddBean.travel_business_remarks =
                remarkTypeViewHolder.binding.edEditFile.text.toString()
            // 设置备注的初始值或逻辑
            //remarkTypeViewHolder.binding.edEditFile.setText("默认备注")
        }
        mViewModel.createRequest(mAddBean, mTargetFile)
    }

    private fun initializeViews(addBean: BusinessAddBean) {
//        if (!IS_TEST_MODE) {
//            return
//        }
        // 获取和处理差旅申请表
        val businessTableViewHolder = mTopAdapter?.findTargetViewHolder(R.id.business_table)
        if (businessTableViewHolder is CommonToolsListAdapter.ChooseDataTypeHolder) {
            // 设置差旅申请表的初始值
            //businessTableViewHolder.binding.edEditFile.setText("默认值")
        }

        // 获取和处理出发时间
        val launchTimeViewHolder = mTopAdapter?.findTargetViewHolder(R.id.launch_time)
        if (launchTimeViewHolder is CommonToolsListAdapter.ChooseDateTypeHolder) {
            // 设置出发时间的初始值
            launchTimeViewHolder.binding.tvSubTitle.text = addBean.travel_business_begin_date
        }

        // 获取和处理返回时间
        val backTimeViewHolder = mTopAdapter?.findTargetViewHolder(R.id.back_time)
        if (backTimeViewHolder is CommonToolsListAdapter.ChooseDateTypeHolder) {
            backTimeViewHolder.binding.tvSubTitle.text = addBean.travel_business_end_date
            // 设置返回时间的初始值
            //backTimeViewHolder.binding.tvSubTitle.text = "默认返回时间"
        }

        // 获取和处理出差时长
        val durationViewHolder = mTopAdapter?.findTargetViewHolder(R.id.duration)
        if (durationViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            durationViewHolder.binding.edEditFile.setText(addBean.travel_business_duration)
            // 设置出差时长的初始值
            //durationViewHolder.binding.edEditFile.setText("3")
        }

        // 获取和处理出差行程
        val businessTripsViewHolder = mTopAdapter?.findTargetViewHolder(R.id.business_trips)
        if (businessTripsViewHolder is CommonToolsListAdapter.RemarkTypeHolder) {
            // 设置出差行程的初始值
            businessTripsViewHolder.binding.edInputRemark.setText(addBean.travel_business_trip)
        }

        // 获取和处理列支项目
        val itemizedItemsViewHolder = mTopAdapter?.findTargetViewHolder(R.id.itemized_items)
        if (itemizedItemsViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置列支项目的初始值
            itemizedItemsViewHolder.binding.edEditFile.setText(addBean.travel_business_project)
        }

        // 获取和处理预算号
        val budgetNumberViewHolder = mTopAdapter?.findTargetViewHolder(R.id.budget_number)
        if (budgetNumberViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置预算号的初始值
            budgetNumberViewHolder.binding.edEditFile.setText(addBean.travel_business_budget_number)
        }

        // 获取和处理飞机费用
        val planeViewHolder = mTravelAdapter?.findTargetViewHolder(R.id.plane)
        if (planeViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置飞机费用的初始值
            planeViewHolder.binding.edEditFile.setText(addBean.travel_business_airplane_expenses)
        }

        // 获取和处理飞机财务审核金额
        val planeFinancialAuditAmountViewHolder =
            mTravelAdapter?.findTargetViewHolder(R.id.plane_financial_audit_amount)
        if (planeFinancialAuditAmountViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置飞机财务审核金额的初始值
            planeFinancialAuditAmountViewHolder.binding.edEditFile.setText(addBean.travel_business_airplane_financial_audit_amount)
        }

        // 获取和处理火车费用
        val trainFeeViewHolder = mTravelAdapter?.findTargetViewHolder(R.id.train_fee)
        if (trainFeeViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置火车费用的初始值
            trainFeeViewHolder.binding.edEditFile.setText(addBean.travel_business_train_expenses)
        }

        // 获取和处理火车财务审核金额
        val trainFinancialAuditAmountViewHolder =
            mTravelAdapter?.findTargetViewHolder(R.id.train_financial_audit_amount)
        if (trainFinancialAuditAmountViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置火车财务审核金额的初始值
            trainFinancialAuditAmountViewHolder.binding.edEditFile.setText(addBean.travel_business_train_financial_audit_amount)
        }

        // 获取和处理汽车费用
        val busViewHolder = mTravelAdapter?.findTargetViewHolder(R.id.bus)
        if (busViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置汽车费用的初始值
            busViewHolder.binding.edEditFile.setText(addBean.travel_business_car_expenses)
        }

        // 获取和处理汽车财务审核金额
        val busFinancialAuditAmountViewHolder =
            mTravelAdapter?.findTargetViewHolder(R.id.bus_financial_audit_amount)
        if (busFinancialAuditAmountViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置汽车财务审核金额的初始值
            busFinancialAuditAmountViewHolder.binding.edEditFile.setText(addBean.travel_business_car_financial_audit_amount)
        }

        // 获取和处理轮船费用
        val shipViewHolder = mTravelAdapter?.findTargetViewHolder(R.id.ship)
        if (shipViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置轮船费用的初始值
            shipViewHolder.binding.edEditFile.setText(addBean.travel_business_ship_expenses)
        }

        // 获取和处理轮船财务审核金额
        val shipFinancialAuditAmountViewHolder =
            mTravelAdapter?.findTargetViewHolder(R.id.ship_financial_audit_amount)
        if (shipFinancialAuditAmountViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置轮船财务审核金额的初始值
            shipFinancialAuditAmountViewHolder.binding.edEditFile.setText(addBean.travel_business_ship_financial_audit_amount)
        }

        // 获取和处理交通费小计
        val subtotalOfTransportationViewHolder =
            mTravelAdapter?.findTargetViewHolder(R.id.subtotal_of_transportation)
        if (subtotalOfTransportationViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置交通费小计的初始值
            subtotalOfTransportationViewHolder.binding.edEditFile.setText(addBean.travel_business_traffic_expenses)
        }

        // 获取和处理住宿费
        val accommodationFeeViewHolder =
            mCostSubsidyAdapter?.findTargetViewHolder(R.id.accommodation_fee)
        if (accommodationFeeViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置住宿费的初始值
            accommodationFeeViewHolder.binding.edEditFile.setText(addBean.travel_business_accommodation_expenses)
        }

        // 获取和处理住宿费财务审核金额
        val accommodationFinancialFeeViewHolder =
            mCostSubsidyAdapter?.findTargetViewHolder(R.id.accommodation_financial_fee)
        if (accommodationFinancialFeeViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置住宿费财务审核金额的初始值
            accommodationFinancialFeeViewHolder.binding.edEditFile.setText(addBean.travel_business_accommodation_financial_audit_amount)
        }

        // 获取和处理出差天数
        val businessDayCountViewHolder =
            mCostSubsidyAdapter?.findTargetViewHolder(R.id.business_day_count)
        if (businessDayCountViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置出差天数的初始值
            businessDayCountViewHolder.binding.edEditFile.setText(addBean.travel_business_days)
        }

        // 获取和处理财务天数审核数
        val financialAuditDayCountViewHolder =
            mCostSubsidyAdapter?.findTargetViewHolder(R.id.business_financial_audit_day_count)
        if (financialAuditDayCountViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置财务天数审核数的初始值
            financialAuditDayCountViewHolder.binding.edEditFile.setText(addBean.travel_business_financial_audit_days)
        }

        // 获取和处理伙食补助费小计
        val subtotalOfFoodAllowanceViewHolder =
            mCostSubsidyAdapter?.findTargetViewHolder(R.id.subtotal_of_food_allowance)
        if (subtotalOfFoodAllowanceViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置伙食补助费小计的初始值
            subtotalOfFoodAllowanceViewHolder.binding.edEditFile.setText(addBean.travel_business_food_expenses)
        }

        // 获取和处理公杂费小计
        val subtotalOfPublicAndMiscellaneousExpensesViewHolder =
            mCostSubsidyAdapter?.findTargetViewHolder(R.id.subtotal_of_public_and_miscellaneous_expenses)
        if (subtotalOfPublicAndMiscellaneousExpensesViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置公杂费小计的初始值
            subtotalOfPublicAndMiscellaneousExpensesViewHolder.binding.edEditFile.setText(addBean.travel_business_miscellaneous_expenses)
        }

        // 获取和处理订票费
        val bookingFeeViewHolder = mCostSubsidyAdapter?.findTargetViewHolder(R.id.booking_fee)
        if (bookingFeeViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置订票费的初始值
            bookingFeeViewHolder.binding.edEditFile.setText(addBean.travel_business_ticket_expenses)
        }

        // 获取和处理订票财务审核金额
        val bookingFinancialAuditFeeViewHolder =
            mCostSubsidyAdapter?.findTargetViewHolder(R.id.booking_financial_audit_fee)
        if (bookingFinancialAuditFeeViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置订票财务审核金额的初始值
            bookingFinancialAuditFeeViewHolder.binding.edEditFile.setText(addBean.travel_business_ticket_financial_audit_amount)
        }

        // 获取和处理其他费用小计
        val subtotalOfCostAssistanceViewHolder =
            mCostSubsidyAdapter?.findTargetViewHolder(R.id.subtotal_of_cost_assistance)
        if (subtotalOfCostAssistanceViewHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置其他费用小计的初始值
            subtotalOfCostAssistanceViewHolder.binding.edEditFile.setText(addBean.travel_business_subsidy_expenses)
        }
        /**
         * other start
         */

        val conferenceFeHolder =
            mOtherFeeAdapter?.findTargetViewHolder(R.id.conference_fee)
        if (conferenceFeHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置其他费用小计的初始值
            conferenceFeHolder.binding.edEditFile.setText(addBean.travel_business_meeting_expenses)
        }

        val conferenceFinancialHolder =
            mOtherFeeAdapter?.findTargetViewHolder(R.id.conference_fee_financial_audit)
        if (conferenceFinancialHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置其他费用小计的初始值
            conferenceFinancialHolder.binding.edEditFile.setText(addBean.travel_business_meeting_financial_audit_amount)
        }

        val rentHolder =
            mOtherFeeAdapter?.findTargetViewHolder(R.id.rental_fee)
        if (rentHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置其他费用小计的初始值
            rentHolder.binding.edEditFile.setText(addBean.travel_business_rent_expenses)
        }

        val rentFinanceHolder =
            mOtherFeeAdapter?.findTargetViewHolder(R.id.rental_fee_financial_audit_fee)
        if (rentFinanceHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置其他费用小计的初始值
            rentFinanceHolder.binding.edEditFile.setText(addBean.travel_business_rent_financial_audit_amount)
        }

        val refundFeeHolder =
            mOtherFeeAdapter?.findTargetViewHolder(R.id.refund_fee)
        if (refundFeeHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置其他费用小计的初始值
            refundFeeHolder.binding.edEditFile.setText(addBean.travel_business_refund_expenses)
        }

        val refundFeeFinanceHolder =
            mOtherFeeAdapter?.findTargetViewHolder(R.id.refund_fee_financial_audit)
        if (refundFeeFinanceHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置其他费用小计的初始值
            refundFeeFinanceHolder.binding.edEditFile.setText(addBean.travel_business_refund_financial_audit_amount)
        }

        val otherFeeHolder =
            mOtherFeeAdapter?.findTargetViewHolder(R.id.other_fee)
        if (otherFeeHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置其他费用小计的初始值
            otherFeeHolder.binding.edEditFile.setText(addBean.travel_business_other_expenses)
        }

        val otherFeeFinanceHolder =
            mOtherFeeAdapter?.findTargetViewHolder(R.id.other_fee_financial_audit)
        if (otherFeeFinanceHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置其他费用小计的初始值
            otherFeeFinanceHolder.binding.edEditFile.setText(addBean.travel_business_other_financial_audit_amount)
        }

        val otherFeeCountHolder =
            mOtherFeeAdapter?.findTargetViewHolder(R.id.other_fee_count)
        if (otherFeeCountHolder is CommonToolsListAdapter.EditTypeHolder) {
            // 设置其他费用小计的初始值
            otherFeeCountHolder.binding.edEditFile.setText(addBean.travel_business_other_expenses_subtotal)
        }
        //other end


//        // 获取和处理其他费用小计
//        val otherFeeCountViewHolder = mOtherFeeAdapter?.findTargetViewHolder(R.id.other_fee_count)
//        if (otherFeeCountViewHolder is CommonToolsListAdapter.EditTypeHolder) {
//            mAddBean.travel_business_other_expenses_subtotal =
//                otherFeeCountViewHolder.binding.edEditFile.text.toString().formatDecimal()
//            // 设置其他费用小计的初始值或逻辑
//            //otherFeeCountViewHolder.binding.edEditFile.setText("0")
//        }
//
//        // 获取和处理合计金额
//        val totalAmountViewHolder = mBottomAdapter?.findTargetViewHolder(R.id.total_amount)
//        if (totalAmountViewHolder is CommonToolsListAdapter.EditTypeHolder) {
//            // 设置合计金额的初始值或逻辑
//            //totalAmountViewHolder.binding.edEditFile.setText("0")
//            if (TextUtils.isEmpty(totalAmountViewHolder.binding.edEditFile.text.toString())) {
//                ToastUtils.show("请输入合计金额")
//                return
//            } else {
//                mAddBean.travel_business_total_amount =
//                    totalAmountViewHolder.binding.edEditFile.text.toString().formatDecimal()
//            }
//        }
//
//        var mTargetFile: File? = null
//        // 获取和处理附件
//        val annexViewHolder = mBottomAdapter?.findTargetViewHolder(R.id.annex)
//        if (annexViewHolder is CommonToolsListAdapter.UploadFileType) {
//            // 设置附件的初始值或逻辑
//            //annexViewHolder.binding.edEditFile.setText("默认附件")
//            mTargetFile = annexViewHolder.mFileAdapter?.getTargetFile(this)
//        }
//
//        // 获取和处理收款单位名称
//        val receivingUnitViewHolder = mBottomAdapter?.findTargetViewHolder(R.id.receiving_unit)
//        if (receivingUnitViewHolder is CommonToolsListAdapter.EditTypeHolder) {
//            if (TextUtils.isEmpty(receivingUnitViewHolder.binding.edEditFile.text.toString())) {
//                ToastUtils.show("请输入收款单位名称")
//                return
//            } else {
//                mAddBean.travel_business_receiving_unit =
//                    receivingUnitViewHolder.binding.edEditFile.text.toString()
//            }
//            // 设置收款单位名称的初始值或逻辑
//            //receivingUnitViewHolder.binding.edEditFile.setText("默认收款单位")
//        }
//
//        // 获取和处理开户行
//        val bankViewHolder = mBottomAdapter?.findTargetViewHolder(R.id.bank)
//        if (bankViewHolder is CommonToolsListAdapter.EditTypeHolder) {
//            // 设置开户行的初始值或逻辑
//            //bankViewHolder.binding.edEditFile.setText("默认开户行")
//            if (TextUtils.isEmpty(bankViewHolder.binding.edEditFile.text.toString())) {
//                ToastUtils.show("请输入开户行")
//                return
//            } else {
//                mAddBean.travel_business_bank =
//                    bankViewHolder.binding.edEditFile.text.toString()
//            }
//
//        }
//
//        // 获取和处理账号
//        val accountViewHolder = mBottomAdapter?.findTargetViewHolder(R.id.account)
//        if (accountViewHolder is CommonToolsListAdapter.EditTypeHolder) {
//            // 设置账号的初始值或逻辑
//            // accountViewHolder.binding.edEditFile.setText("默认账号")
//            if (TextUtils.isEmpty(accountViewHolder.binding.edEditFile.text.toString())) {
//                ToastUtils.show("请输入账号")
//                return
//            } else {
//                mAddBean.travel_business_account =
//                    accountViewHolder.binding.edEditFile.text.toString()
//            }
//        }
//
//        // 获取和处理备注
//        val remarkTypeViewHolder = mBottomAdapter?.findTargetViewHolder(R.id.remark_type)
//        if (remarkTypeViewHolder is CommonToolsListAdapter.EditTypeHolder) {
//            mAddBean.travel_business_remarks =
//                remarkTypeViewHolder.binding.edEditFile.text.toString()
//            // 设置备注的初始值或逻辑
//            //remarkTypeViewHolder.binding.edEditFile.setText("默认备注")
//        }


    }

}